package com.wyzz.hr.action;

import com.wyzz.hr.base.DWRUtil;
import com.wyzz.hr.base.Status;
import com.wyzz.hr.pojo.Empsalaryconfig;
import com.wyzz.hr.util.Interpreter;
import com.wyzz.hr.util.StringUtil;

public class DWRforFormulaValidate extends CompAction implements Status {

	public DWRforFormulaValidate() {
	}

	public String validateFormula(String formula) {
		if ("error".equalsIgnoreCase(DWRUtil
				.checkAuth("acctItemDef", "execute")))
			return StringUtil.message(msgNoAuth, new Object[] { "noauth" });
		Interpreter interpreter = new Interpreter();
		System.out.println(formula);
		String info = interpreter.formulaValidate(formula,
				new Empsalaryconfig());
		System.out.println(info+"llll");
		if (!"SUCC".equals(info))
			return StringUtil.message(msgFormulaIllegal, new Object[] {
					formula, info });
		else
			return StringUtil.message(msgFormulaLegal, new Object[] { "SUCC",
					formula });
	}

	private static final long serialVersionUID = 1L;
}
